﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CardGame;
using Cards;

namespace TexasHoldem
{
    public class Round : IDisposable
    {
        private Table table;

        //private List<Tuple<Player[], decimal>> pots;

        public Round(Table table)
        {
            if (table == null)
            {
                throw new ArgumentNullException("table", "You must specify a table.");
            }

            this.table = table;

            Deck deck = Deck.FullShuffledDeck;

            foreach (var player in this.table.Players)
            {
                this.table.PocketCards.Add(player, new Tuple<Card,Card>(deck.PopCard(), deck.PopCard()));
            }

            this.table.CommunityCards = new Tuple<Card,Card,Card,Card,Card>(deck.PopCard(), deck.PopCard(), deck.PopCard(), deck.PopCard(), deck.PopCard());

            //this.table.Hands
        }

        #region IDisposable Members

        public void Dispose()
        {
            this.table.PocketCards.Clear();
            this.table.CommunityCards = null;
        }

        #endregion
    }
}